package GUI;

import Model.BillDetailTableModel;
import Model.BillTableModel;
import Model.ReceiptTableModel;
import Entity.ConnectionSQL;
import Entity.Report;
import Entity.User;
import Model.ReportTableModel;
import java.awt.CardLayout;
import java.awt.Color;
import java.sql.Timestamp;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.RowFilter;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.TableColumn;
import javax.swing.table.TableRowSorter;


public class SaleManagerFrame extends javax.swing.JFrame {
    ConnectionSQL conn;
    ResourceBundle message;
    CardLayout cardLayout;
    User u;
    BillTableModel billModel;
    BillDetailTableModel billDetailModel;
    ReceiptTableModel receiptModel;
    ReportTableModel reportModel;
    TableRowSorter<BillTableModel> billFilter;
    
    /** Creates new form SalerManagerFrame */
    public SaleManagerFrame(User u) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(DialogDetailBill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(DialogDetailBill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(DialogDetailBill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(DialogDetailBill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        initComponents();
        this.setLocationRelativeTo(null);
        this.u = u;
        threadInitData();
        cardLayout = (CardLayout)pnlCenter.getLayout();
        cardLayout.addLayoutComponent(pnlBill, "pnlBill");
        cardLayout.addLayoutComponent(pnlStatistic, "pnlStatistic");
        cardLayout.addLayoutComponent(pnlHome, "pnlHome");
        billFilter = new TableRowSorter<BillTableModel>(billModel);
        tblBill.setRowSorter(billFilter);
        lblMessage.setOpaque(true);
        lblMessage.setBackground(Color.white);
        lblMessage.setText("");
        threadCheckConnection();
        
    }
    private void threadInitData(){
        new Thread("thread init"){
            @Override
            public void run(){
                message = ResourceBundle.getBundle("messages",Locale.ENGLISH);
                conn = new ConnectionSQL(message);
                
                billModel = new BillTableModel(conn.getBill(), message);
                tblBill.setModel(billModel);
                billDetailModel = new BillDetailTableModel(conn.getAllBillDetail(), message);
                receiptModel = new ReceiptTableModel(conn.getReceipt(), message);
                tblReceipt.setModel(receiptModel);
                TableColumn col = null;
                for(int i=0;i<billModel.getColumnCount();i++){
                    col = tblBill.getColumnModel().getColumn(i);
                    switch(i){
                        case 0 : col.setPreferredWidth(5);break;
                        case 1 : col.setPreferredWidth(50);break;
                        case 2 : col.setPreferredWidth(80);break;
                        case 3 : col.setPreferredWidth(80);break;
                        case 4 : col.setPreferredWidth(30);break;
                        case 5 : col.setPreferredWidth(10);break;
                    }
                    
                }
                TableColumn column = null;
                for(int i=0;i<receiptModel.getColumnCount();i++){
                    column = tblReceipt.getColumnModel().getColumn(i);
                    switch(i){
                        case 0 : column.setPreferredWidth(5);break;
                        case 1 : column.setPreferredWidth(50);break;
                        case 2 : column.setPreferredWidth(50);break;
                        case 3 : column.setPreferredWidth(50);break;
                        case 4 : column.setPreferredWidth(20);break;
                        case 5 : column.setPreferredWidth(50);break;
                    }
                    
                }   
                lblBillAmount.setText(String.valueOf(billModel.getRowCount()));
                lblMoneyTransact.setText(String.valueOf(billModel.getAmountOfMoneyTransacted()));
                lblBillCancel.setText(String.valueOf(billModel.getAmountBillCancelled()));
                lblReceiptAmount.setText(String.valueOf(receiptModel.getRowCount()));
                lblProductReturn.setText(String.valueOf(receiptModel.getAmountProductReturn()));
            }
        }.start();
    }
    private void threadCheckConnection(){
        if(conn == null)
            lblConnect.setText("Lost Connection");
        else
            lblConnect.setText("Connecting");
    }
    private void newFilter(){
        String strSearch = txtSearch.getText();
        if(strSearch == null){
            billFilter.setRowFilter(null);
        }else
            billFilter.setRowFilter(RowFilter.regexFilter(strSearch));
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlNorth = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        pnlSouth = new javax.swing.JPanel();
        lblConnect = new javax.swing.JLabel();
        pnlCenter = new javax.swing.JPanel();
        pnlBill = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblReceipt = new javax.swing.JTable();
        jPanel12 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        lblProductReturn = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        lblReceiptAmount = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblBill = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        lblBillAmount = new javax.swing.JLabel();
        lblMoneyTransact = new javax.swing.JLabel();
        lblBillCancel = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        lblCanceled = new javax.swing.JLabel();
        lblNotApproved = new javax.swing.JLabel();
        lblApproved = new javax.swing.JLabel();
        lblAll = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        txtSearch = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        pnlStatistic = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        lblItem = new javax.swing.JTable();
        pnlHome = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        lblSenderUser = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        lblSenderName = new javax.swing.JLabel();
        lblDate = new javax.swing.JLabel();
        lblMessage = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tblReport = new javax.swing.JTable();
        jPanel13 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        btnHome = new javax.swing.JButton();
        btnBill = new javax.swing.JButton();
        btnConfigure = new javax.swing.JButton();
        jPanel15 = new javax.swing.JPanel();
        lblChangePassword = new javax.swing.JLabel();
        lblSignOut = new javax.swing.JLabel();
        lblInfo = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sale And Inventory Application");

        pnlNorth.setBackground(new java.awt.Color(0, 0, 0));
        pnlNorth.setPreferredSize(new java.awt.Dimension(518, 118));
        pnlNorth.setLayout(new java.awt.BorderLayout());

        jPanel5.setBackground(new java.awt.Color(0, 0, 0));

        jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/invent icon.png"))); // NOI18N

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel7)
                .addContainerGap(66, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel7)
                .addContainerGap(16, Short.MAX_VALUE))
        );

        pnlNorth.add(jPanel5, java.awt.BorderLayout.LINE_START);

        jPanel6.setBackground(new java.awt.Color(0, 0, 0));

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/header.jpg"))); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(599, Short.MAX_VALUE)
                .addComponent(jLabel6))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(jLabel6)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlNorth.add(jPanel6, java.awt.BorderLayout.CENTER);

        getContentPane().add(pnlNorth, java.awt.BorderLayout.PAGE_START);

        pnlSouth.setPreferredSize(new java.awt.Dimension(496, 20));

        lblConnect.setText("All right reserved");

        javax.swing.GroupLayout pnlSouthLayout = new javax.swing.GroupLayout(pnlSouth);
        pnlSouth.setLayout(pnlSouthLayout);
        pnlSouthLayout.setHorizontalGroup(
            pnlSouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSouthLayout.createSequentialGroup()
                .addGap(393, 393, 393)
                .addComponent(lblConnect, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(660, Short.MAX_VALUE))
        );
        pnlSouthLayout.setVerticalGroup(
            pnlSouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblConnect, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
        );

        getContentPane().add(pnlSouth, java.awt.BorderLayout.PAGE_END);

        pnlCenter.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        pnlCenter.setLayout(new java.awt.CardLayout());

        pnlBill.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlBill.setLayout(new java.awt.BorderLayout());

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Receipt")));
        jPanel2.setPreferredSize(new java.awt.Dimension(700, 160));
        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel9.setPreferredSize(new java.awt.Dimension(700, 200));
        jPanel9.setLayout(new javax.swing.BoxLayout(jPanel9, javax.swing.BoxLayout.LINE_AXIS));

        tblReceipt.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(tblReceipt);

        jPanel9.add(jScrollPane2);

        jPanel2.add(jPanel9, java.awt.BorderLayout.CENTER);

        jPanel12.setPreferredSize(new java.awt.Dimension(230, 200));

        jLabel4.setText("Amount of the product is returned:  ");

        lblProductReturn.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblProductReturn.setForeground(new java.awt.Color(255, 0, 0));
        lblProductReturn.setText("jLabel5");

        jLabel5.setText("Amount of the receipt have created: ");

        lblReceiptAmount.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblReceiptAmount.setForeground(new java.awt.Color(255, 0, 0));
        lblReceiptAmount.setText("jLabel6");

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(lblReceiptAmount))
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(lblProductReturn))
                    .addComponent(jLabel4)
                    .addComponent(jLabel5))
                .addContainerGap(41, Short.MAX_VALUE))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblReceiptAmount)
                .addGap(11, 11, 11)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblProductReturn)
                .addContainerGap(33, Short.MAX_VALUE))
        );

        jPanel2.add(jPanel12, java.awt.BorderLayout.LINE_END);

        pnlBill.add(jPanel2, java.awt.BorderLayout.PAGE_END);

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Bill"));
        jPanel3.setLayout(new java.awt.BorderLayout());

        jPanel10.setPreferredSize(new java.awt.Dimension(452, 200));
        jPanel10.setLayout(new javax.swing.BoxLayout(jPanel10, javax.swing.BoxLayout.LINE_AXIS));

        tblBill.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblBill.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblBillMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblBill);

        jPanel10.add(jScrollPane1);

        jPanel3.add(jPanel10, java.awt.BorderLayout.CENTER);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setPreferredSize(new java.awt.Dimension(230, 301));

        jLabel1.setText("Amount of the bill have created: ");

        jLabel2.setText("A deal of money is transacted: ");

        jLabel3.setText("Amount of the bill is canceled: ");

        lblBillAmount.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblBillAmount.setForeground(new java.awt.Color(255, 0, 0));
        lblBillAmount.setText("jLabel5");

        lblMoneyTransact.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblMoneyTransact.setForeground(new java.awt.Color(255, 0, 0));
        lblMoneyTransact.setText("jLabel5");

        lblBillCancel.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblBillCancel.setForeground(new java.awt.Color(255, 0, 0));
        lblBillCancel.setText("jLabel5");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(lblBillCancel))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(lblMoneyTransact))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(lblBillAmount))
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addContainerGap(58, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(3, 3, 3)
                .addComponent(lblBillAmount)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2)
                .addGap(2, 2, 2)
                .addComponent(lblMoneyTransact)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblBillCancel)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.add(jPanel1, java.awt.BorderLayout.LINE_END);

        pnlBill.add(jPanel3, java.awt.BorderLayout.CENTER);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Filter"));
        jPanel4.setPreferredSize(new java.awt.Dimension(934, 100));
        jPanel4.setLayout(new java.awt.BorderLayout());

        jPanel16.setPreferredSize(new java.awt.Dimension(230, 60));

        lblCanceled.setText("View the bill canceled");
        lblCanceled.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblCanceled.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblCanceledMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblCanceledMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lblCanceledMouseExited(evt);
            }
        });

        lblNotApproved.setText("View the bill not approved");
        lblNotApproved.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblNotApproved.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblNotApprovedMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblNotApprovedMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lblNotApprovedMouseExited(evt);
            }
        });

        lblApproved.setText("View the bill approved");
        lblApproved.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblApproved.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblApprovedMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblApprovedMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lblApprovedMouseExited(evt);
            }
        });

        lblAll.setText("View All");
        lblAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblAll.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblAllMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblAllMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                blAllMouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblCanceled, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                    .addComponent(lblNotApproved, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel16Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblApproved, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(846, 846, 846))
                    .addGroup(jPanel16Layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addComponent(lblAll)
                        .addContainerGap(627, Short.MAX_VALUE))))
        );
        jPanel16Layout.setVerticalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNotApproved)
                    .addComponent(lblApproved, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCanceled)
                    .addComponent(lblAll))
                .addContainerGap(23, Short.MAX_VALUE))
        );

        jPanel4.add(jPanel16, java.awt.BorderLayout.CENTER);

        jPanel8.setPreferredSize(new java.awt.Dimension(250, 53));

        txtSearch.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchCaretUpdate(evt);
            }
        });

        jLabel8.setText("Search: ");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap(49, Short.MAX_VALUE)
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addContainerGap(32, Short.MAX_VALUE))
        );

        jPanel4.add(jPanel8, java.awt.BorderLayout.LINE_END);

        pnlBill.add(jPanel4, java.awt.BorderLayout.PAGE_START);

        pnlCenter.add(pnlBill, "card3");

        pnlStatistic.setPreferredSize(new java.awt.Dimension(400, 425));

        lblItem.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane3.setViewportView(lblItem);

        javax.swing.GroupLayout pnlStatisticLayout = new javax.swing.GroupLayout(pnlStatistic);
        pnlStatistic.setLayout(pnlStatisticLayout);
        pnlStatisticLayout.setHorizontalGroup(
            pnlStatisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlStatisticLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(613, Short.MAX_VALUE))
        );
        pnlStatisticLayout.setVerticalGroup(
            pnlStatisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlStatisticLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(259, Short.MAX_VALUE))
        );

        pnlCenter.add(pnlStatistic, "card3");

        pnlHome.setLayout(new java.awt.BorderLayout());

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Detail"));

        jLabel9.setText("From :");

        jLabel10.setText("Sender's Name :");

        jLabel11.setText("Date :");

        lblMessage.setBackground(new java.awt.Color(255, 255, 255));
        lblMessage.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10))
                .addGap(18, 18, 18)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lblSenderUser, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
                    .addComponent(lblSenderName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(95, 95, 95)
                .addComponent(lblMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 356, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(363, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(lblSenderUser, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel10)
                            .addComponent(lblSenderName, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel11)
                            .addComponent(lblDate, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(lblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE))
                .addContainerGap())
        );

        pnlHome.add(jPanel7, java.awt.BorderLayout.PAGE_END);

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Message from user"));
        jPanel11.setLayout(new javax.swing.BoxLayout(jPanel11, javax.swing.BoxLayout.LINE_AXIS));

        tblReport.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblReport.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblReportMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tblReport);

        jPanel11.add(jScrollPane4);

        pnlHome.add(jPanel11, java.awt.BorderLayout.CENTER);

        pnlCenter.add(pnlHome, "card4");

        getContentPane().add(pnlCenter, java.awt.BorderLayout.CENTER);

        jPanel13.setBackground(new java.awt.Color(0, 0, 0));
        jPanel13.setMinimumSize(new java.awt.Dimension(493, 80));
        jPanel13.setPreferredSize(new java.awt.Dimension(140, 408));
        jPanel13.setLayout(new java.awt.BorderLayout());

        jPanel14.setBackground(new java.awt.Color(153, 153, 255));
        jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        btnHome.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/hom.png"))); // NOI18N
        btnHome.setText("HOME");
        btnHome.setPreferredSize(new java.awt.Dimension(140, 60));
        btnHome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHomeActionPerformed(evt);
            }
        });
        jPanel14.add(btnHome);

        btnBill.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/bill_of_document (1).png"))); // NOI18N
        btnBill.setText("Bill");
        btnBill.setPreferredSize(new java.awt.Dimension(140, 60));
        btnBill.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBillActionPerformed(evt);
            }
        });
        jPanel14.add(btnBill);

        btnConfigure.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/service_manager.png"))); // NOI18N
        btnConfigure.setText("Configure");
        btnConfigure.setPreferredSize(new java.awt.Dimension(140, 60));
        btnConfigure.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnConfigureActionPerformed(evt);
            }
        });
        jPanel14.add(btnConfigure);

        jPanel13.add(jPanel14, java.awt.BorderLayout.CENTER);

        jPanel15.setBackground(new java.awt.Color(255, 204, 102));
        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "USER", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel15.setForeground(new java.awt.Color(153, 153, 255));
        jPanel15.setPreferredSize(new java.awt.Dimension(120, 140));

        lblChangePassword.setFont(new java.awt.Font("Tahoma", 0, 14));
        lblChangePassword.setText("Change Password");
        lblChangePassword.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblChangePassword.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblChangePasswordMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblChangePasswordMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lblChangePasswordMouseExited(evt);
            }
        });

        lblSignOut.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lblSignOut.setText("Sign Out");
        lblSignOut.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblSignOut.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblSignOutMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblSignOutMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lblSignOutMouseExited(evt);
            }
        });

        lblInfo.setFont(new java.awt.Font("Tahoma", 0, 14));
        lblInfo.setText("Information");
        lblInfo.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblInfo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblInfoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblInfoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lblInfoMouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblChangePassword, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
            .addComponent(lblInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
            .addComponent(lblSignOut, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addComponent(lblInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblChangePassword, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblSignOut, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(14, Short.MAX_VALUE))
        );

        jPanel13.add(jPanel15, java.awt.BorderLayout.PAGE_START);

        getContentPane().add(jPanel13, java.awt.BorderLayout.LINE_START);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnBillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBillActionPerformed
        cardLayout.show(pnlCenter, "pnlBill");
    }//GEN-LAST:event_btnBillActionPerformed

    private void btnHomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHomeActionPerformed
        cardLayout.show(pnlCenter,"pnlHome");
        viewReport();
    }//GEN-LAST:event_btnHomeActionPerformed

    private void tblBillMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblBillMouseClicked
        if(evt.getClickCount() == 2){
            int x = tblBill.getSelectedRow();
            int billID = (Integer)tblBill.getValueAt(x, 0);
            new DialogBillDetail(this, rootPaneCheckingEnabled,billDetailModel.getBillDetailByBillID(billID)).setVisible(true);          
        }
        
    }//GEN-LAST:event_tblBillMouseClicked

    private void lblInfoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblInfoMouseClicked
        new DialogUserInfor(this, true, u, message).setVisible(true);
    }//GEN-LAST:event_lblInfoMouseClicked

    private void lblInfoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblInfoMouseEntered
        lblInfo.setForeground(Color.BLUE);
        
    }//GEN-LAST:event_lblInfoMouseEntered

    private void lblInfoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblInfoMouseExited
        lblInfo.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblInfoMouseExited

    private void lblChangePasswordMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblChangePasswordMouseClicked
        new DialogChangePass(this, true, u, message).setVisible(true);
    }//GEN-LAST:event_lblChangePasswordMouseClicked

    private void lblChangePasswordMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblChangePasswordMouseEntered
        lblChangePassword.setForeground(Color.BLUE);
    }//GEN-LAST:event_lblChangePasswordMouseEntered

    private void lblChangePasswordMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblChangePasswordMouseExited
        lblChangePassword.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblChangePasswordMouseExited

    private void lblSignOutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblSignOutMouseClicked
        this.dispose();
        try {
                    UIManager.setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel");
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(LoginFrame.class.getName()).log(Level.SEVERE, null, ex);
                } catch (InstantiationException ex) {
                    Logger.getLogger(LoginFrame.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IllegalAccessException ex) {
                    Logger.getLogger(LoginFrame.class.getName()).log(Level.SEVERE, null, ex);
                } catch (UnsupportedLookAndFeelException ex) {
                    Logger.getLogger(LoginFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
        java.awt.EventQueue.invokeLater(new Runnable() {

                public void run() {
                    new LoginFrame().setVisible(true);

                }
            });
    }//GEN-LAST:event_lblSignOutMouseClicked

    private void lblSignOutMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblSignOutMouseEntered
        lblSignOut.setForeground(Color.BLUE);
    }//GEN-LAST:event_lblSignOutMouseEntered

    private void lblSignOutMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblSignOutMouseExited
        lblSignOut.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblSignOutMouseExited

    private void btnConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConfigureActionPerformed
        new DialogConfig(this, rootPaneCheckingEnabled, message).setVisible(true);
    }//GEN-LAST:event_btnConfigureActionPerformed

    private void txtSearchCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchCaretUpdate
       newFilter();
    }//GEN-LAST:event_txtSearchCaretUpdate

    private void lblNotApprovedMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblNotApprovedMouseClicked
        billFilter.setRowFilter(RowFilter.regexFilter(message.getString("billNotApprove")));
        
    }//GEN-LAST:event_lblNotApprovedMouseClicked

    private void lblApprovedMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblApprovedMouseClicked
        billFilter.setRowFilter(RowFilter.regexFilter(message.getString("billApproved")));
    }//GEN-LAST:event_lblApprovedMouseClicked

    private void lblCanceledMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCanceledMouseClicked
        billFilter.setRowFilter(RowFilter.regexFilter(message.getString("billCanceled")));
    }//GEN-LAST:event_lblCanceledMouseClicked

    private void lblAllMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblAllMouseClicked
        billFilter.setRowFilter(null);
    }//GEN-LAST:event_lblAllMouseClicked

    private void lblAllMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblAllMouseEntered
        lblAll.setForeground(Color.BLUE);
    }//GEN-LAST:event_lblAllMouseEntered

    private void blAllMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_blAllMouseExited
        lblAll.setForeground(Color.BLACK);
    }//GEN-LAST:event_blAllMouseExited

    private void lblCanceledMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCanceledMouseEntered
        lblCanceled.setForeground(Color.BLUE);
    }//GEN-LAST:event_lblCanceledMouseEntered

    private void lblCanceledMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCanceledMouseExited
        lblCanceled.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblCanceledMouseExited

    private void lblNotApprovedMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblNotApprovedMouseEntered
        lblNotApproved.setForeground(Color.BLUE);
    }//GEN-LAST:event_lblNotApprovedMouseEntered

    private void lblNotApprovedMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblNotApprovedMouseExited
        lblNotApproved.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblNotApprovedMouseExited

    private void lblApprovedMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblApprovedMouseEntered
        lblApproved.setForeground(Color.BLUE);
    }//GEN-LAST:event_lblApprovedMouseEntered

    private void lblApprovedMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblApprovedMouseExited
        lblApproved.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblApprovedMouseExited

    private void tblReportMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblReportMouseClicked
        if(evt.getClickCount()==1){
            int select  = tblReport.getSelectedRow();
        if(select !=-1){
            Report report = reportModel.get(select);
            conn.changeStatusReport(report.getReportID());
            User usersend = conn.getUserByID(report.getSenderID());
            lblSenderUser.setText(report.getSenderAccount());
            lblSenderName.setText(usersend.getFirstName()+" "+usersend.getLastName());
            Timestamp timestamp = new Timestamp(report.getDatetime().getTime());
            String date =timestamp.toString();
            lblDate.setText(date);
            lblMessage.setText(report.getMessages());
            viewReport();
        }
        }
    }//GEN-LAST:event_tblReportMouseClicked

    public static void main(String args[]) {
          
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new SaleManagerFrame(null).setVisible(true);
            }
        });
}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBill;
    private javax.swing.JButton btnConfigure;
    private javax.swing.JButton btnHome;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JLabel lblAll;
    private javax.swing.JLabel lblApproved;
    private javax.swing.JLabel lblBillAmount;
    private javax.swing.JLabel lblBillCancel;
    private javax.swing.JLabel lblCanceled;
    private javax.swing.JLabel lblChangePassword;
    private javax.swing.JLabel lblConnect;
    private javax.swing.JLabel lblDate;
    private javax.swing.JLabel lblInfo;
    private javax.swing.JTable lblItem;
    private javax.swing.JLabel lblMessage;
    private javax.swing.JLabel lblMoneyTransact;
    private javax.swing.JLabel lblNotApproved;
    private javax.swing.JLabel lblProductReturn;
    private javax.swing.JLabel lblReceiptAmount;
    private javax.swing.JLabel lblSenderName;
    private javax.swing.JLabel lblSenderUser;
    private javax.swing.JLabel lblSignOut;
    private javax.swing.JPanel pnlBill;
    private javax.swing.JPanel pnlCenter;
    private javax.swing.JPanel pnlHome;
    private javax.swing.JPanel pnlNorth;
    private javax.swing.JPanel pnlSouth;
    private javax.swing.JPanel pnlStatistic;
    private javax.swing.JTable tblBill;
    private javax.swing.JTable tblReceipt;
    private javax.swing.JTable tblReport;
    private javax.swing.JTextField txtSearch;
    // End of variables declaration//GEN-END:variables

    private void viewReport() {
        List<Report> listReport  = conn.getReportsByReceiver(u.getId());
        reportModel = new ReportTableModel(listReport, message);
        tblReport.setModel(reportModel);
        reportModel.fireTableDataChanged();
    }
}
